# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductPerformanceView do
  @moduledoc """
  Fields available for query in `product_performance_view` table. Product performance data for your account, including performance metrics (for example, `clicks`) and dimensions according to which performance metrics are segmented (for example, `offer_id`). Values of product dimensions, such as `offer_id`, reflect the state of a product at the time of the impression. Segment fields cannot be selected in queries without also selecting at least one metric field. Values are only set for fields requested explicitly in the request's search query.

  ## Attributes

  *   `brand` (*type:* `String.t`, *default:* `nil`) - Brand of the product. Segment.
  *   `categoryL1` (*type:* `String.t`, *default:* `nil`) - [Product category (1st level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in Google's product taxonomy. Segment.
  *   `categoryL2` (*type:* `String.t`, *default:* `nil`) - [Product category (2nd level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in Google's product taxonomy. Segment.
  *   `categoryL3` (*type:* `String.t`, *default:* `nil`) - [Product category (3rd level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in Google's product taxonomy. Segment.
  *   `categoryL4` (*type:* `String.t`, *default:* `nil`) - [Product category (4th level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in Google's product taxonomy. Segment.
  *   `categoryL5` (*type:* `String.t`, *default:* `nil`) - [Product category (5th level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in Google's product taxonomy. Segment.
  *   `clickThroughRate` (*type:* `float()`, *default:* `nil`) - Click-through rate - the number of clicks merchant's products receive (clicks) divided by the number of times the products are shown (impressions). Metric.
  *   `clicks` (*type:* `String.t`, *default:* `nil`) - Number of clicks. Metric.
  *   `conversionRate` (*type:* `float()`, *default:* `nil`) - Number of conversions divided by the number of clicks, reported on the impression date. Metric. Available only for the `FREE` traffic source.
  *   `conversionValue` (*type:* `GoogleApi.MerchantAPI.Reports_v1beta.Model.Price.t`, *default:* `nil`) - Value of conversions attributed to the product, reported on the conversion date. Metric. Available only for the `FREE` traffic source.
  *   `conversions` (*type:* `float()`, *default:* `nil`) - Number of conversions attributed to the product, reported on the conversion date. Depending on the attribution model, a conversion might be distributed across multiple clicks, where each click gets its own credit assigned. This metric is a sum of all such credits. Metric. Available only for the `FREE` traffic source.
  *   `customLabel0` (*type:* `String.t`, *default:* `nil`) - Custom label 0 for custom grouping of products. Segment.
  *   `customLabel1` (*type:* `String.t`, *default:* `nil`) - Custom label 1 for custom grouping of products. Segment.
  *   `customLabel2` (*type:* `String.t`, *default:* `nil`) - Custom label 2 for custom grouping of products. Segment.
  *   `customLabel3` (*type:* `String.t`, *default:* `nil`) - Custom label 3 for custom grouping of products. Segment.
  *   `customLabel4` (*type:* `String.t`, *default:* `nil`) - Custom label 4 for custom grouping of products. Segment.
  *   `customerCountryCode` (*type:* `String.t`, *default:* `nil`) - Code of the country where the customer is located at the time of the event. Represented in the ISO 3166 format. Segment. If the customer country cannot be determined, a special 'ZZ' code is returned.
  *   `date` (*type:* `GoogleApi.MerchantAPI.Reports_v1beta.Model.Date.t`, *default:* `nil`) - Date in the merchant timezone to which metrics apply. Segment. Condition on `date` is required in the `WHERE` clause.
  *   `impressions` (*type:* `String.t`, *default:* `nil`) - Number of times merchant's products are shown. Metric.
  *   `marketingMethod` (*type:* `String.t`, *default:* `nil`) - Marketing method to which metrics apply. Segment.
  *   `offerId` (*type:* `String.t`, *default:* `nil`) - Merchant-provided id of the product. Segment.
  *   `productTypeL1` (*type:* `String.t`, *default:* `nil`) - [Product type (1st level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in merchant's own product taxonomy. Segment.
  *   `productTypeL2` (*type:* `String.t`, *default:* `nil`) - [Product type (2nd level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in merchant's own product taxonomy. Segment.
  *   `productTypeL3` (*type:* `String.t`, *default:* `nil`) - [Product type (3rd level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in merchant's own product taxonomy. Segment.
  *   `productTypeL4` (*type:* `String.t`, *default:* `nil`) - [Product type (4th level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in merchant's own product taxonomy. Segment.
  *   `productTypeL5` (*type:* `String.t`, *default:* `nil`) - [Product type (5th level)](https://developers.google.com/shopping-content/guides/reports/segmentation#category_and_product_type) in merchant's own product taxonomy. Segment.
  *   `title` (*type:* `String.t`, *default:* `nil`) - Title of the product. Segment.
  *   `week` (*type:* `GoogleApi.MerchantAPI.Reports_v1beta.Model.Date.t`, *default:* `nil`) - First day of the week (Monday) of the metrics date in the merchant timezone. Segment.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :brand => String.t() | nil,
          :categoryL1 => String.t() | nil,
          :categoryL2 => String.t() | nil,
          :categoryL3 => String.t() | nil,
          :categoryL4 => String.t() | nil,
          :categoryL5 => String.t() | nil,
          :clickThroughRate => float() | nil,
          :clicks => String.t() | nil,
          :conversionRate => float() | nil,
          :conversionValue => GoogleApi.MerchantAPI.Reports_v1beta.Model.Price.t() | nil,
          :conversions => float() | nil,
          :customLabel0 => String.t() | nil,
          :customLabel1 => String.t() | nil,
          :customLabel2 => String.t() | nil,
          :customLabel3 => String.t() | nil,
          :customLabel4 => String.t() | nil,
          :customerCountryCode => String.t() | nil,
          :date => GoogleApi.MerchantAPI.Reports_v1beta.Model.Date.t() | nil,
          :impressions => String.t() | nil,
          :marketingMethod => String.t() | nil,
          :offerId => String.t() | nil,
          :productTypeL1 => String.t() | nil,
          :productTypeL2 => String.t() | nil,
          :productTypeL3 => String.t() | nil,
          :productTypeL4 => String.t() | nil,
          :productTypeL5 => String.t() | nil,
          :title => String.t() | nil,
          :week => GoogleApi.MerchantAPI.Reports_v1beta.Model.Date.t() | nil
        }

  field(:brand)
  field(:categoryL1)
  field(:categoryL2)
  field(:categoryL3)
  field(:categoryL4)
  field(:categoryL5)
  field(:clickThroughRate)
  field(:clicks)
  field(:conversionRate)
  field(:conversionValue, as: GoogleApi.MerchantAPI.Reports_v1beta.Model.Price)
  field(:conversions)
  field(:customLabel0)
  field(:customLabel1)
  field(:customLabel2)
  field(:customLabel3)
  field(:customLabel4)
  field(:customerCountryCode)
  field(:date, as: GoogleApi.MerchantAPI.Reports_v1beta.Model.Date)
  field(:impressions)
  field(:marketingMethod)
  field(:offerId)
  field(:productTypeL1)
  field(:productTypeL2)
  field(:productTypeL3)
  field(:productTypeL4)
  field(:productTypeL5)
  field(:title)
  field(:week, as: GoogleApi.MerchantAPI.Reports_v1beta.Model.Date)
end

defimpl Poison.Decoder, for: GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductPerformanceView do
  def decode(value, options) do
    GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductPerformanceView.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.MerchantAPI.Reports_v1beta.Model.ProductPerformanceView do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
